package cn.xjfcloud.onedriveserver.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.xjfcloud.onedriveserver.pojo.dto.CommonConfig;
import cn.xjfcloud.onedriveserver.service.CommonConfigService;

@RestController
public class CommonConfigController {

	@Autowired
	private CommonConfigService commonConfigService;

	/**
	 * 更新common config
	 * @param commonConfig
	 * @return
	 */
	@RequestMapping("updateCommonConfig")
	public Map<String, Object> updateCommonConfig(CommonConfig commonConfig) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		Integer count = commonConfigService.updateCommonConfig(commonConfig);
		if (count == 1) {
			resultMap.put("code", "0");
			resultMap.put("msg", "success");
		} else {
			resultMap.put("code", "10001");
			resultMap.put("msg", "not have config");
		}
		return resultMap;
	}
}
